package IO_demo;

import java.io.FileReader;
import java.io.IOException;

/**
 * @author Summerday
 */
public class FileTest {

    public static void main(String[] args) throws IOException {
        FileReader reader = new FileReader("D:\\b.txt");
        //定义数组作为缓冲区
        char[] cs = new char[5];
        //定义一个变量记录每次读取的字符
        int hasRead;
        //读取到末尾为-1
        while ((hasRead = reader.read(cs)) != -1) {
            System.out.println(new String(cs, 0, hasRead));
        }
        reader.close();
    }
}
